package cn.edu.bnu.bnuboy.app;

import java.util.Stack;

import android.app.Activity;
import android.support.v4.app.Fragment;

public class MyFragmentManager {
	private static Stack<Fragment> fragmentStack;
	private static MyFragmentManager instance;
	public void addFragment(Fragment fragment){
		if(fragmentStack==null){
			fragmentStack=new Stack<Fragment>();
		}
		fragmentStack.add(fragment);
	}
	public static MyFragmentManager getMyFragmentManager(){
		if(instance==null){
			instance=new MyFragmentManager();
		}
		return instance;
	}
	public static Fragment currentFragment(){
		return fragmentStack.lastElement();
	}
	public static void finishFragment(){
		fragmentStack.pop();
	}
}
